How to Install Python Pip on Ubuntu 22.04 or 20.04 您所在的位置:网站首页 pip install from jfrog How to Install Python Pip on Ubuntu 22.04 or 20.04

How to Install Python Pip on Ubuntu 22.04 or 20.04

#How to Install Python Pip on Ubuntu 22.04 or 20.04| 来源: 网络整理| 查看: 265

TwitterFacebookLinkedInHacker News1RedditTelegramWhatsAppTumblrVKShare1SHARE

Python is a popular programming language for web development, data analysis, artificial intelligence, and more. One of the best tools for managing Python packages is pip, a package manager for Python. Pip is included with Python 2.7.9 and later and Python 3.4 and later, but it may not be installed by default on some Linux distributions. This guide will show you how to install Python Pip on Ubuntu Linux using the command line terminal.

Table of Contents

Step 1: Update Ubuntu

It is recommended that you update your system to ensure all packages are up-to-date before installing Python Pip.

sudo apt update

Before proceeding, you can check what updates will be made to your system by using the command for listing upgrades.

apt list --upgradable

If updates are available, use the command provided to start the upgrade process.

sudo apt upgrade Method 1: Install Pip with APT Package Manager

The first method of installing Pip on Ubuntu Linux is to use the APT package manager. This is the most straightforward method, and it is recommended.

In your terminal, use the following command to install Pip 3.

sudo apt install python3-pip

Verify the installation by running the following command.

pip3 --version

Example output from my machine:

pip 22.0.2 from /home/joshua/.local/lib/python3.10/site-packages/pip (python 3.10) Method 2: Install Pip from Python Package Index (PyPI)

The second method of installing pip3 on Ubuntu Linux is to use the Python Package Index (PyPI). This method is recommended for advanced users who want more control over the installation process.

See alsoHow to Install Chromium on Fedora Linux

First, ensure you have already installed Python 3.

sudo apt install python3

Now download the get-pip.py file in your terminal by running the following wget command.

wget https://bootstrap.pypa.io/get-pip.py

Next, using with Python 3 being already installed in most circumstances, you just simply use the following command to install Pip 3.

sudo python3 get-pip.py

As the same with installing the APT version, run a quick version check of Pip 3 with the following command.

pip3 --version

Example output:

pip 22.3.1 from /home/joshua/.local/lib/python3.10/site-packages/pip (python 3.10) Python Pip Command Examples

To keep it simple, this guide will cover a few examples of what you need to know when using Python Pip, but there are many ways to use it.

Installing a Pip package:

To install a package using pip3, you can use the following command.

pip3 install package_name

For example, to install the requests library, you would run.

pip3 install requests Upgrading a Pip package:

To upgrade a package that is already installed, you can use the following command.

pip3 install --upgrade package_name

For example, to upgrade the requests library to the latest version, you would run.

pip3 install --upgrade requests Uninstalling a Pip package:

To uninstall a package that is no longer needed, you can use the following command.

pip3 uninstall package_name Listing installed Pip 3 packages:

To list all the packages that are currently installed, you can use the following command:

pip3 list

This will output a list of all the packages and their versions that are currently installed.

Conclusion

This guide demonstrated two ways to install Python Pip on Ubuntu Linux using the command line terminal. The first method uses the APT package manager, the most straightforward method, and is recommended for beginners. The second method uses the Python Package Index (PyPI), recommended for advanced users who want more control over the installation process.

To find out further information on PIP, visit the official documentation.

See alsoHow to Remove Packages on Ubuntu Command Line


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有